package cn.edu.tsinghua.service.impl;

import java.util.List;

import cn.edu.tsinghua.dao.impl.PageDAO;
import cn.edu.tsinghua.service.IAdminPageService;
import cn.edu.tsinghua.util.IC;
import cn.edu.tsinghua.vo.BuyInformationVO;
import cn.edu.tsinghua.vo.CompanyVO;
import cn.edu.tsinghua.vo.ComponentVO;
import cn.edu.tsinghua.vo.PersonalCustomerVO;
import cn.edu.tsinghua.vo.SupplyInformationVO;

public class AdminPageServiceImpl implements IAdminPageService {

	private PageDAO pageDAO = new PageDAO();
	
	public List<BuyInformationVO> getAllBuyInfo(int pageNum) {
		return pageDAO.getListByPageNum("from BuyInformationVO b order by b.publishDate desc", null, pageNum, IC.BACK_PAGE_SIZE);
	}

	public int getAllBuyInfoPageCounts() {
		return pageDAO.getPageCounts("from BuyInformationVO b order by b.publishDate desc", null, IC.BACK_PAGE_SIZE);
	}

	public List<CompanyVO> getAllCompany(int pageNum) {
		return pageDAO.getListByPageNum("from CompanyVO cv order by cv.remark1 desc", null, pageNum, IC.BACK_PAGE_SIZE);
	}

	public int getAllCompanyPageCounts() {
		return pageDAO.getPageCounts("from CompanyVO cv order by cv.remark1 desc", null, IC.BACK_PAGE_SIZE);
	}

	public List<PersonalCustomerVO> getAllPerson(int pageNum) {
		return pageDAO.getListByPageNum("from PersonalCustomerVO ", null, pageNum, IC.BACK_PAGE_SIZE);
	}

	public int getAllPersonPageCounts() {
		return pageDAO.getPageCounts("from PersonalCustomerVO ", null, IC.BACK_PAGE_SIZE);
	}

	public List<SupplyInformationVO> getAllSupplyInfo(int pageNum) {
		return pageDAO.getListByPageNum("from SupplyInformationVO sv order by sv.publishDate desc", null, pageNum, IC.BACK_PAGE_SIZE);
	}

	public int getAllSupplyInfoPageCounts() {
		return pageDAO.getPageCounts("from SupplyInformationVO sv order by sv.publishDate desc", null, IC.BACK_PAGE_SIZE);
	}

	public List<BuyInformationVO> getAuditedBuyInfo(int pageNum) {
		return pageDAO.getListByPageNum("from BuyInformationVO b where b.buyState!=2 order by b.publishDate desc", null, pageNum, IC.BACK_PAGE_SIZE);
	}

	public int getAuditedBuyInfoPageCounts() {
		return pageDAO.getPageCounts("from BuyInformationVO b where b.buyState!=2 order by b.publishDate desc", null, IC.BACK_PAGE_SIZE);
	}

	public List<CompanyVO> getAuditedCompany(int pageNum) {
		return pageDAO.getListByPageNum("from CompanyVO c where c.remark2!=2 order by c.remark1 desc", null, pageNum, IC.BACK_PAGE_SIZE);
		
	}

	public int getAuditedCompanyPageCounts() {
		return pageDAO.getPageCounts("from CompanyVO c where c.remark2!=2 order by c.remark1 desc", null, IC.BACK_PAGE_SIZE);
	}

	public List<PersonalCustomerVO> getAuditedPerson(int pageNum) {
		return pageDAO.getListByPageNum("from PersonalCustomerVO c where c.remark1!=2 order by c.remark1 desc", null, pageNum, IC.BACK_PAGE_SIZE);
	}

	public int getAuditedPersonPageCounts() {
		return pageDAO.getPageCounts("from PersonalCustomerVO c where c.remark1!=2 order by c.remark1 desc", null, IC.BACK_PAGE_SIZE);
	}

	public List<SupplyInformationVO> getAuditedSupplyInfo(int pageNum) {
		return pageDAO.getListByPageNum("from SupplyInformationVO c where c.supplyState!=2 order by c.publishDate desc", null, pageNum, IC.BACK_PAGE_SIZE);
	}

	public int getAuditedSupplyInfoPageCounts() {
		return pageDAO.getPageCounts("from SupplyInformationVO c where c.supplyState!=2 order by c.publishDate desc", null, IC.BACK_PAGE_SIZE);
	}

	public List<BuyInformationVO> getDeletedBuyInfo(int pageNum) {
		return pageDAO.getListByPageNum("from BuyInformationVO c where c.buyState=1 order by c.publishDate desc", null, pageNum, IC.BACK_PAGE_SIZE);
	}

	public int getDeletedBuyInfoPageCounts() {
		return pageDAO.getPageCounts("from BuyInformationVO c where c.buyState=1 order by c.publishDate desc", null, IC.BACK_PAGE_SIZE);
	}

	public List<CompanyVO> getDeletedCompany(int pageNum) {
		return pageDAO.getListByPageNum("from CompanyVO c where c.remark2=1 order by c.remark1 desc", null, pageNum, IC.BACK_PAGE_SIZE);
	}

	public int getDeletedCompanyPageCounts() {
		return pageDAO.getPageCounts("from CompanyVO c where c.remark2=1 order by c.remark1 desc", null, IC.BACK_PAGE_SIZE);
	}

	public List<PersonalCustomerVO> getDeletedPerson(int pageNum) {
		return pageDAO.getListByPageNum("from PersonalCustomerVO c where c.remark1=1", null, pageNum, IC.BACK_PAGE_SIZE);
	}

	public int getDeletedPersonPageCounts() {
		return pageDAO.getPageCounts("from PersonalCustomerVO c where c.remark1=1", null, IC.BACK_PAGE_SIZE);
	}

	public List<SupplyInformationVO> getDeletedSupplyInfo(int pageNum) {
		return pageDAO.getListByPageNum("from SupplyInformationVO c where c.supplyState=1 order by c.publishDate desc", null, pageNum, IC.BACK_PAGE_SIZE);
	}

	public int getDeletedSupplyInfoPageCounts() {
		return pageDAO.getPageCounts("from SupplyInformationVO c where c.supplyState=1 order by c.publishDate desc", null, IC.BACK_PAGE_SIZE);
	}

	public List<BuyInformationVO> getDisAuditBuyInfo(int pageNum) {
		return pageDAO.getListByPageNum("from BuyInformationVO c where c.buyState=2 order by c.publishDate desc", null, pageNum, IC.BACK_PAGE_SIZE);
	}

	public int getDisAuditBuyInfoPageCounts() {
		return pageDAO.getPageCounts("from BuyInformationVO c where c.buyState=2 order by c.publishDate desc", null, IC.BACK_PAGE_SIZE);
	}

	public List<CompanyVO> getDisAuditCompany(int pageNum) {
		return pageDAO.getListByPageNum("from CompanyVO c where c.remark2=2 order by c.remark1 desc", null, pageNum, IC.BACK_PAGE_SIZE);
		
	}

	public int getDisAuditCompanyPageCounts() {
		return pageDAO.getPageCounts("from CompanyVO c where c.remark2=2 order by c.remark1 desc", null, IC.BACK_PAGE_SIZE);
		
	}

	public List<PersonalCustomerVO> getDisAuditPerson(int pageNum) {
		return pageDAO.getListByPageNum("from PersonalCustomerVO c where c.remark1=2", null, pageNum, IC.BACK_PAGE_SIZE);
		
	}

	public int getDisAuditPersonPageCounts() {
		return pageDAO.getPageCounts("from PersonalCustomerVO c where c.remark1=2", null, IC.BACK_PAGE_SIZE);
	}

	public List<SupplyInformationVO> getDisAuditSupplyInfo(int pageNum) {
		return pageDAO.getListByPageNum("from SupplyInformationVO c where c.supplyState=2 order by c.publishDate desc", null, pageNum, IC.BACK_PAGE_SIZE);
		
	}

	public int getDisAuditSupplyInfoPageCounts() {
		return pageDAO.getPageCounts("from SupplyInformationVO c where c.supplyState=2 order by c.publishDate desc", null, IC.BACK_PAGE_SIZE);
	}

	public List<BuyInformationVO> getExsitedBuyInfo(int pageNum) {
		return pageDAO.getListByPageNum("from BuyInformationVO c where c.buyState!=1 order by c.publishDate desc", null, pageNum, IC.BACK_PAGE_SIZE);
		
	}

	public int getExsitedBuyInfoPageCounts() {
		return pageDAO.getPageCounts("from BuyInformationVO c where c.buyState!=1 order by c.publishDate desc", null, IC.BACK_PAGE_SIZE);
	}

	public List<CompanyVO> getExsitedCompany(int pageNum) {
		return pageDAO.getListByPageNum("from CompanyVO c where c.remark2!=1 order by c.remark1 desc", null, pageNum, IC.BACK_PAGE_SIZE);
		
	}

	public int getExsitedCompanyPageCounts() {
		return pageDAO.getPageCounts("from CompanyVO c where c.remark2!=1 order by c.remark1 desc", null, IC.BACK_PAGE_SIZE);
		
	}

	public List<PersonalCustomerVO> getExsitedPerson(int pageNum) {
		return pageDAO.getListByPageNum("from PersonalCustomerVO c where c.remark1!=1", null, pageNum, IC.BACK_PAGE_SIZE);
		
	}

	public int getExsitedPersonPageCounts() {
		return pageDAO.getPageCounts("from PersonalCustomerVO c where c.remark1!=1", null, IC.BACK_PAGE_SIZE);
		
	}

	public List<SupplyInformationVO> getExsitedSupplyInfo(int pageNum) {
		return pageDAO.getListByPageNum("from SupplyInformationVO c where c.supplyState!=1 order by c.publishDate desc", null, pageNum, IC.BACK_PAGE_SIZE);
		
	}

	public int getExsitedSupplyInfoPageCounts() {
		return pageDAO.getPageCounts("from SupplyInformationVO c where c.supplyState!=1 order by c.publishDate desc", null, IC.BACK_PAGE_SIZE);
		
	}

	public List<ComponentVO> getAllComponent(int pageNum) {
		return pageDAO.getListByPageNum("from ComponentVO c order by c.remark1 desc", null, pageNum, IC.BACK_PAGE_SIZE);
		
	}

	public int getAllComponentPageCounts() {
		return pageDAO.getPageCounts("from ComponentVO c order by c.remark1 desc", null, IC.BACK_PAGE_SIZE);
		
	}

	public List<ComponentVO> getAuditedComponent(int pageNum) {
		return pageDAO.getListByPageNum("from ComponentVO c where c.deleteFlag!=2 order by c.remark1 desc", null, pageNum, IC.BACK_PAGE_SIZE);
		
	}

	public int getAuditedComponentPageCounts() {
		return pageDAO.getPageCounts("from ComponentVO c where c.deleteFlag!=2 order by c.remark1 desc", null, IC.BACK_PAGE_SIZE);
		
	}

	public List<ComponentVO> getDisAuditComponent(int pageNum) {
		return pageDAO.getListByPageNum("from ComponentVO c where c.deleteFlag=2 order by c.remark1 desc", null, pageNum, IC.BACK_PAGE_SIZE);
	}

	public int getDisAuditComponentPageCounts() {
		return pageDAO.getPageCounts("from ComponentVO c where c.deleteFlag=2 order by c.remark1 desc", null, IC.BACK_PAGE_SIZE);
		
	}

}
